package ffhs.lernkartei.domain;

import java.io.Serializable;

import com.j256.ormlite.dao.ForeignCollection;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.field.ForeignCollectionField;
import com.j256.ormlite.table.DatabaseTable;

/**
 * Stack Domain Objekt.
 * 
 * @author schwendh
 * 
 */
@DatabaseTable
public class Stack implements Serializable
{
	// Serial ID
	private static final long serialVersionUID = -7005171371026872557L;
	// Globale public Konstanten
	public static final String STACK_FIELD_NAME = "stack";
	// Datenbank Felder
	@DatabaseField(generatedId = true)
	private Integer id;
	@DatabaseField(columnName = STACK_FIELD_NAME)
	private String stack;
	@ForeignCollectionField(eager = true)
	private ForeignCollection<Card> cards;

	// Getters & Setters
	public Integer getId()
	{
		return id;
	}

	public void setId(Integer id)
	{
		this.id = id;
	}

	public String getStack()
	{
		return stack;
	}

	public void setStack(String stack)
	{
		this.stack = stack;
	}

	public ForeignCollection<Card> getCards()
	{
		return cards;
	}

	public void setCards(ForeignCollection<Card> cards)
	{
		this.cards = cards;
	}

	// Wird vom ArrayAdapter in der ListView verwendet
	@Override
	public String toString()
	{
		return stack;
	}
}